<?php
/**
 * Created by PhpStorm.
 * Author: ls
 * Time: 2022/1/14 10:50
 * Desc:
 */
class Model_Provider_Destination extends ORM
{
    public static function match_destination_id_by_keyword($keyword)
    {
        $destinationId = DB::select('id')
            ->from('destinations')
            ->where('kindname', 'like', "{$keyword}%")
            ->execute()
            ->get('id');
        return $destinationId ? $destinationId : '';
    }

    public static function destination_parents_id($destinationId)
    {
        $parentsStr = '';
        $parentsId = Model_Destinations::getParentsStr($destinationId);
        if(!empty($parentsId)){
            $parentsStr = implode(',', $parentsId);
        }
        return $parentsStr;
    }
}